package cn.dao.Impl;

import cn.base.Impl.IBaseDaoImpl;
import cn.dao.ApproveInfoDao;
import cn.domain.Application;
import cn.domain.ApproveInfo;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by huangjiaxiang on 2017/5/5.
 */
@Repository
public class ApproveInfoDaoImpl extends IBaseDaoImpl<ApproveInfo> implements ApproveInfoDao {
    /**
     * 根据Id查询所有的流程
     * @return
     */
    public List<ApproveInfo> findApproveInfoListByApplicationId(Application application) {
        String sql="FROM ApproveInfo WHERE applicaTion.id = ? ORDER BY aproverTime ASC";
        Query query=session().createQuery(sql).setParameter(0,application.getId());
        return query.list();
    }
}
